﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Alos.Common;
using Alos.Entity;
using Alos.IService;
using Newtonsoft.Json;
using System.Threading.Tasks;

namespace Alos.LanClass.Api
{
    /// <summary>
    /// 学生提交记录表（主观题）
    /// </summary>
    public class ReSubjectiveQuestionController : ApiController
    {
        IReSubjectiveQuestionService ReSubjectiveQuestionService;
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="_ReSubjectiveQuestionService"></param>
        public ReSubjectiveQuestionController(IReSubjectiveQuestionService _ReSubjectiveQuestionService)
        {           
            ReSubjectiveQuestionService = _ReSubjectiveQuestionService;
        }
        /// <summary>
        /// 添加学生提交记录(主观题)
        /// <param name="data">学生提交主观题</param>
        /// </summary>
        [HttpPost]
        [Route("api/ReSubjectiveQuestion/CreateReSubjectiveQuestion")]
        public JsonRtn<dynamic> CreateReSubjectiveQuestion([FromBody]dynamic data)
        {
            List<ReSubjectiveQuestion> reSubjectiveQuestions = JsonConvert.DeserializeObject<List<ReSubjectiveQuestion>>(data);
            var jsRtn = new JsonRtn<dynamic>();
            jsRtn.message = ReSubjectiveQuestionService.CreateZhuGuan(reSubjectiveQuestions) ? "true" : "false";
            return jsRtn;                     
        }
    }
}
